import 'package:flutter/material.dart';

class Utils {
  ///
  /// 加载本地图片
  ///
  /// * [name] 图片名
  ///
  /// * [size] 图片size
  ///
  /// * [fit] 模式
  ///
  static Image loadImage(
    String name, {
    Size? size,
    BoxFit fit = BoxFit.contain,
  }) =>
      Image.asset(
        'assets/images/$name.png',
        width: size?.width,
        height: size?.height,
        fit: fit,
      );

  /// 获取音频路径
  static String getAudioPath(String name) => 'audios/$name.mp3';
}
